package com.autonavi.yunda.yunji.core.engine.handler;

import com.autonavi.yunda.yunji.common.utils.SpringUtil;
import com.autonavi.yunda.yunji.core.service.ICommonDbService;

import java.util.List;
import java.util.Map;

/**
 * @author cizhong.wcs
 * @date 2023/7/19 14:07
 * db 数据处理
 */
public class CommonSqlHandler {
    /**
     * @param dbName 数据库名称
     * @param sql    执行sql
     */
    public static List<Map<String, Object>> sql(String dbName, String sql) {
        ICommonDbService service = SpringUtil.getBean(ICommonDbService.class);
        return service.sql(dbName, sql);
    }

    /**
     * @param dbName  数据库名称
     * @param sql     执行sql
     * @param options 配置项
     */
    public static Object sql(String dbName, String sql, Map<String, Object> options) {
        ICommonDbService service = SpringUtil.getBean(ICommonDbService.class);
        return service.sql(dbName, sql, options);
    }
}
